@extends('admin.layout.layout')
@section('content')
  <div class="row">
     <div class="col-lg-12">
          <h1 class="page-header">订单列表</h1>
     </div>
  </div>
   <div class="col-lg-12"> 
  <div class="panel panel-default"> 
  <div class="panel-heading">
    用户订单列表
  </div> 
  <!-- /.panel-heading --> 
  <div class="panel-body"> 
   <div class="dataTable_wrapper"> 
    <div class="dataTables_wrapper form-inline dt-bootstrap no-footer" id="dataTables-example_wrapper">
      
    <form action="" method="get">
     <div class="row">
      <div class="col-sm-6">
       <div id="dataTables-example_length" class="dataTables_length">
        <label>显示 <select class="form-control input-sm" aria-controls="dataTables-example" name="num">
        <option value="2">2</option>
      
        </select> 条</label>
       </div>
      </div>
      <div class="col-sm-6">
       <div class="dataTables_filter" id="dataTables-example_filter">
        <label>用户名:<input name="keywords" class="form-control input-sm" type="search" />
        </label>
        <button class="btn btn-info">查询</button>
       </div>
      </div>
     </div>
    </form>

     <div class="row">
      <div class="col-sm-12">
       <table aria-describedby="dataTables-example_info" role="grid" class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example"> 
        <thead> 
         <tr role="row">
          <th aria-label="Rendering engine: activate to sort column descending" colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting_asc">订单号</th>
          <th aria-label="Browser: activate to sort column ascending"  colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">用户id</th>
          <th aria-label="Platform(s): activate to sort column ascending"  colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">收货地址</th>
          <th aria-label="Engine version: activate to sort column ascending"  colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">订单日期</th>
          <th aria-label="CSS grade: activate to sort column ascending"  colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">预计到达日期</th>
          <th aria-label="CSS grade: activate to sort column ascending"  colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">运输方式</th>
          <th aria-label="CSS grade: activate to sort column ascending"  colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">付款方式</th>
           <th aria-label="CSS grade: activate to sort column ascending"  colspan="1" rowspan="1" aria-controls="dataTables-example" tabindex="0" class="sorting">操作</th>
         </tr>
        </thead> 
        <tbody> 
        @foreach($ld as $k=>$v)
       <!-- <?php var_dump($v->id); ?> -->
           <tr role="row" class="gradeA odd sid"> 
            <td class="sorting_1 sid">{{$v->id}}</td> 
            <td class="center">{{$v->uid}}</td> 
            <td class="center">{{$v->address}}</td> 
            <td class="center">{{$v->itime}}</td> 
            <td class="center">{{$v->stime}}</td>
            <td class="center">{{$v->send}}</td>
            <td class="center">{{$v->payment}}</td>
            <td class="center">
            <a class="fa fa-trash-o delete">删除</a>
            |
            <a href="{{url('/admin/order/edit',['uid'=>$v->id])}}" class="fa fa-wrench">修改</a>
            </td> 
           </tr>

        @endforeach
        </tbody> 
       </table>
      </div>
     </div>
     <div class="row">
      
      <div class="col-sm-6">
       <div id="dataTables-example_paginate" class="dataTables_paginate paging_simple_numbers">
         
       </div>
      </div>
     </div>
    </div> 
   </div> 
   <!-- /.table-responsive --> 
  </div> 
  <!-- /.panel-body --> 
  </div> 
  <!-- /.panel --> 
  </div> 
  <!-- /.col-lg-12 --> 
@endsection
@section('myjs')
<script type="text/javascript">
  $.ajaxSetup({
      headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
      }
  });
  $('.delete').click(function(){
      
     var id = $(this).parents('tr').find('.sid').html();
     var dd = $(this);
     //发送ajax
      $.post('/admin/order/delete',{id:id},function(data){

        if(data == 1 ){
           dd.parents('tr').remove();
        }else{
          alert('失败');
        }
      })
     return  false;
  })     
</script>
@endsection